<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>发布兑换商品</title>  
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/base.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/detail.css" />
</head>
<body> 
<div class="detail" id="one">
	<form action="__MODULE__/StoreExchange/index/" method="post">
	<div class="form">
    	<ul>
        <input name="u_id" value="{$u_id}" type="hidden">
        <input name="id" value="<eq name="goods.id" value="">0<else/>{$goods.id}</eq>" type="hidden">
        	<li><span>商品标题</span><input name="title" value="{$goods.title}" type="text" placeholder="请输入标题" style="width:75%;"/></li>
        	<li><a onClick="show(2)"><span>商品主图</span><em></em></a></li>
        	<li><span>商品库存</span><input name="num" value="{$goods.num}" type="text" placeholder="请输入库存"/><i>份</i></li>
        	<li><span>商品原价</span><input name="price" value="{$goods.price}" type="text" placeholder="请输入原价"/><i>元</i></li>
        	<li><span>每份分量</span><input name="u_num" value="{$goods.u_num}" type="number" placeholder="请输入数字"/>
            <select name="unit">
						<volist name="list_category" id="vo">
							<option value="{$vo.id}" hassubinfo="true" <?=$vo['id']==$goods['unit']?'selected':''?> >
							{$vo.title}
							</option>
						</volist>
            </select></li>
        	<li style="margin-top:10px;" class="price02"><span>普通会员</span>
            <label><input name="level_integral_1" value="{$goods.level_integral_1}" type="text"/>积分</label>
            <label><input name="level_cash_1" value="{$goods.level_cash_1}" type="text"/>现金</label>
            </li>
        	<li class="price02"><span>黄金会员</span>
            <label><input name="level_integral_2" value="{$goods.level_integral_2}" type="text"/>积分</label>
            <label><input name="level_cash_2" value="{$goods.level_cash_2}" type="text"/>现金</label>
            </li>
        	<li class="price02"><span>白金会员</span>
            <label><input name="level_integral_3" value="{$goods.level_integral_3}" type="text"/>积分</label>
            <label><input name="level_cash_3" value="{$goods.level_cash_3}" type="text"/>现金</label>
            </li>
        	<li class="price02"><span>钻石会员</span>
            <label><input name="level_integral_4" value="{$goods.level_integral_4}" type="text"/>积分</label>
            <label><input name="level_cash_4" value="{$goods.level_cash_4}" type="text"/>现金</label>
            </li>
        	<!--<li style="margin-top:10px;"><a href="notice-dh.html"><span>兑换须知</span></a></li>-->
        	<li style="margin-top:10px;"><a onClick="show(3)"><span>商品详情</span></a></li>
        </ul>
    </div>
	<div class="button"><input type="submit" value="立即发布"/></div>	
    
</div>
  <!--页面二-->
  <input type="hidden" name="head_img" value="{$goods.head_img}">
  <div class="detail" id="two" style="display:none;">
    <div class="upload">
      <ul>
        <li><img src="{$goods.img1}" <eq name="goods.img1" value="">style="display:none;"</eq> width="176" height="172" id="picShow_1" onClick="upimg('1')"/>
          <div class="inner" <neq name="goods.img1" value="">style="display:none;"</neq> > <img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('1')" />
            <input id="img_1" type="file" style="display:none;" type="text" value="{$goods.img1}">
            <h3>上传主图1</h3>
          </div>
        </li>
        <li><img src="{$goods.img2}" <eq name="goods.img2" value="">style="display:none;"</eq> width="176" height="172" id="picShow_2" onClick="upimg('2')"/>
          <div class="inner" <neq name="goods.img2" value="">style="display:none;"</neq> > <img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('2')" />
            <input id="img_2" type="file" style="display:none;" type="text" value="{$goods.img2}">
            <h3>上传主图2</h3>
          </div>
        </li>
        <div class="clear"></div>
      </ul>
    </div>
    <div class="button">
      <input type="button" value="上传" onClick="show(1)"/>
    </div>
  </div>
  <!--页面三-->
  <input type="hidden" name="con_img" value="{$goods.con_img}">
  <div class="detail" id="three" style="display:none;">
    <div class="upload">
      <ul>
        <li><img src="{$goods.img3}" <eq name="goods.img3" value="">style="display:none;"</eq> width="176" height="172" id="picShow_3" onClick="upimg('3')"/>
          <div class="inner" <neq name="goods.img3" value="">style="display:none;"</neq>"><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('3')"/>
          	<input id="img_3" type="file" style="display:none;" type="text" value="{$goods.img3}">
            <h3>上传详情1</h3>
          </div>
        </li>
        <li><img src="{$goods.img4}" <eq name="goods.img4" value="">style="display:none;"</eq> width="176" height="172" id="picShow_4" onClick="upimg('4')"/>
          <div class="inner" <neq name="goods.img4" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('4')"/>
          	<input id="img_4" type="file" style="display:none;" type="text" value="{$goods.img4}">
            <h3>上传详情2</h3>
          </div>
        </li>
        <li><img src="{$goods.img5}" <eq name="goods.img5" value="">style="display:none;"</eq> width="176" height="172" id="picShow_5" onClick="upimg('5')"/>
          <div class="inner" <neq name="goods.img5" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('5')"/>
          	<input id="img_5" type="file" style="display:none;" type="text" value="{$goods.img5}">
            <h3>上传详情3</h3>
          </div>
        </li>
        <li><img src="{$goods.img6}" <eq name="goods.img6" value="">style="display:none;"</eq> width="176" height="172" id="picShow_6" onClick="upimg('6')"/>
          <div class="inner" <neq name="goods.img6" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('6')"/>
          	<input id="img_6" type="file" style="display:none;" type="text" value="{$goods.img6}">
            <h3>上传详情4</h3>
          </div>
        </li>
        <div class="clear"></div>
      </ul>
    </div>
    <div class="button">
      <input type="button" value="上传" onClick="show(1)"/>
    </div>
  </div>
</form>

<script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>

<script type="text/javascript">
<!--上传产品头部两个图片和详情四个图片-->
function show(num){
	$(".detail").css("display","none");
	if(num==1){$("#one").css("display","");}
	if(num==2){$("#two").css("display","");}
	if(num==3){$("#three").css("display","");}
	//首页图链接拼接
	$("input[name='head_img']").val($("#img_1").attr("value")+','+$("#img_2").attr("value"));
	//详情图链接拼接con_img
	$("input[name='con_img']").val($("#img_3").attr("value")+','+$("#img_4").attr("value")+','+$("#img_5").attr("value")+','+$("#img_6").attr("value"));
}//end fun
//图片上传
function upimg(num) {
	//input file 模拟点击
	if($("#img_"+num).attr("type")!="file")$("#img_"+num).attr("type","file");
	$("#img_"+num).click();
}//end fun
$("#img_1").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_1");
	var domain = 'http://www.xiangtws.com';
	var proportion = '1:1';  //图片比例
	var imgsrc=$("#picShow_1");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_1").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_1").attr("type","text");
			$("#img_1").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_2").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_2");
	var domain = 'http://www.xiangtws.com';
	var proportion = '1:1';  //图片比例
	var imgsrc=$("#picShow_2");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_2").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_2").attr("type","text");
			$("#img_2").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_3").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_3");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_3");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_3").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_3").attr("type","text");
			$("#img_3").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun

$("#img_4").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_4");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_4");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_4").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_4").attr("type","text");
			$("#img_4").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_5").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_5");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_5");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_5").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_5").attr("type","text");
			$("#img_5").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_6").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_6");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_6");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_6").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_6").attr("type","text");
			$("#img_6").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun

</script>
    
</body>
</html>